<?php
class Animus_home_m extends Model{
	function Animus_home_m(){
		parent::Model();
		$this->load->database();
	}
	
	function get_all_annonces($per_page, $off_set){
		$this->db->select('*');
		$this->db->from('animus_annonce');
		$this->db->limit($per_page, $off_set);
		$query = $this->db->get();
		return $query->result_array();
	}
	
	function count_annonce($level = NULL){
		$query = $this->db->count_all_results('animus_annonce');
		return $query;	
	}
	
	
	function get_actualite_max_id(){
		$this->db->select_max('id', 'max_id');
		$query = $this->db->get('lehu_actualite');
		return $query;
	}
	
	function get_actualite($maxid){
		$this->db->select('id, introtext, img, title');
		$this->db->from('lehu_actualite');
		$this->db->where('id', $maxid);
		$query = $this->db->get();
		return $query;
	}
	
	function get_actualite_details($id){
		$this->db->select('lehu_actualite.id, lehu_actualite.title, lehu_actualite.content, lehu_actualite.img, 
						   lehu_actualite.posted_time, lehu_actualite.posted_by, 
						   lehu_users.id, lehu_users.username');
		$this->db->from('lehu_actualite');
		$this->db->join('lehu_users', 'lehu_actualite.posted_by = lehu_users.id');
		$this->db->where('lehu_actualite.id', $id);
		$query = $this->db->get();
		return $query;
	}
	
	function get_region(){
		$this->db->select('id,name');
		$this->db->from('animus_region');
		$query = $this->db->get();
		return $query->result_array();
	}

        function get_card_vip() {
        $this->db->select('id,title,content,image');
        $this->db->from('seating_text');
        $this->db->where('id','CARTE FIDELITE');
        $this->db->limit(1);
        $query = $this->db->get();
        return $query->result_array();
    }
}